import sqlite3
class db:
    def createdb(self,dbname):
        conn = sqlite3.connect(dbname)
        return conn   
    #conn.text_factory = str
    def getCursor(self,conn):
        c = conn.cursor();
        return c
    def execsql(self,c,sql):
        c.execute(sql)
    def getDbTblCnt(self,c):
        self.execsql(c,"select count(*) from sqlite_master")
        cnt = c.fetchone()[0]
        return cnt

   #c.execute("create table fileTbl(finename TEXT,filePath TEXT,MD5 TEXT)")
#test ......
'''
testdb = db()
dbconn = testdb.createdb("test.db");
c = testdb.getCursor(dbconn)
cnt = testdb.getDbTblCnt(c)
print cnt
if cnt == 0:
    testdb.execsql(c,"create table fileTbl(finename TEXT,filePath TEXT,MD5 TEXT)")
sql = "insert into fileTbl values(%s,%s,%s)" % ('"test"','"test"','"12212"')
print sql
testdb.execsql(c,sql)

dbconn.commit()
'''
